package com.tiger.life;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.view.View.OnClickListener;
import android.widget.LinearLayout;

public class IndexActivity extends BaseActivity {
	private LinearLayout cigarImg,babyImg,weightImg,calorieImg,chestImg,
	xingzuoImg,eredarImg,rumorImg,dogImg;
	private Intent intent;
	private Bundle bundle=new Bundle();
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        this.requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.index);
        
        initView();
        initAction();
    }
    /**
     * 初始化view
     * tiger
     * 2011-5-24 上午10:47:45
     */
    public void initView(){
    	cigarImg=(LinearLayout)this.findViewById(R.id.cigar_img);
    	babyImg=(LinearLayout)this.findViewById(R.id.baby_img);
    	weightImg=(LinearLayout)this.findViewById(R.id.weight_img);
    	
    	calorieImg=(LinearLayout)this.findViewById(R.id.calorie_img);
    	chestImg=(LinearLayout)this.findViewById(R.id.chest_img);
    	xingzuoImg=(LinearLayout)this.findViewById(R.id.xingzuo_img);
    	
    	eredarImg=(LinearLayout)this.findViewById(R.id.eredar_img);
    	rumorImg=(LinearLayout)this.findViewById(R.id.rumor_img);
    	dogImg=(LinearLayout)this.findViewById(R.id.dog_img);
    }
    /**
     * 初始化各view的动作
     * tiger
     * 2011-5-24 上午10:47:52
     */
    public void initAction(){
    	intent=new Intent(IndexActivity.this,StartActivity.class);
    	
    	cigarImg.setOnClickListener(new OnClickListener(){
			@Override
			public void onClick(View arg0) {
				// TODO Auto-generated method stub
				bundle.putInt(CommonUtil.checkFlag, CommonUtil.checkFlagValue.cigar_Flag);
				intoStart();
			}
    		
    	});
    	babyImg.setOnClickListener(new OnClickListener(){

			@Override
			public void onClick(View arg0) {
				// TODO Auto-generated method stub
				bundle.putInt(CommonUtil.checkFlag, CommonUtil.checkFlagValue.baby_Flag);
				intoStart();
			}
    		
    	});
    	weightImg.setOnClickListener(new OnClickListener(){
			@Override
			public void onClick(View arg0) {
				// TODO Auto-generated method stub
				bundle.putInt(CommonUtil.checkFlag, CommonUtil.checkFlagValue.weight_Flag);
				intoStart();
			}
    	});
    	calorieImg.setOnClickListener(new OnClickListener(){
			@Override
			public void onClick(View arg0) {
				// TODO Auto-generated method stub
				bundle.putInt(CommonUtil.checkFlag, CommonUtil.checkFlagValue.calorie_Flag);
				intoStart();
			}
    		
    	});
    	chestImg.setOnClickListener(new OnClickListener(){

			@Override
			public void onClick(View arg0) {
				// TODO Auto-generated method stub
				bundle.putInt(CommonUtil.checkFlag, CommonUtil.checkFlagValue.chest_Flag);
				intoStart();
			}
    		
    	});
    	xingzuoImg.setOnClickListener(new OnClickListener(){
			@Override
			public void onClick(View arg0) {
				// TODO Auto-generated method stub
				bundle.putInt(CommonUtil.checkFlag, CommonUtil.checkFlagValue.xingzuo_Flag);
				intoStart();
			}
    	});
    	eredarImg.setOnClickListener(new OnClickListener(){
			@Override
			public void onClick(View arg0) {
				// TODO Auto-generated method stub
				bundle.putInt(CommonUtil.checkFlag, CommonUtil.checkFlagValue.eredar_Flag);
				intoStart();
			}
    		
    	});
    	rumorImg.setOnClickListener(new OnClickListener(){

			@Override
			public void onClick(View arg0) {
				// TODO Auto-generated method stub
				bundle.putInt(CommonUtil.checkFlag, CommonUtil.checkFlagValue.rumor_Flag);
				intoStart();
			}
    		
    	});
    	dogImg.setOnClickListener(new OnClickListener(){
			@Override
			public void onClick(View arg0) {
				// TODO Auto-generated method stub
				bundle.putInt(CommonUtil.checkFlag, CommonUtil.checkFlagValue.dog_Flag);
				intoStart();
			}
    	});
    }
    private void intoStart(){
    	intent.putExtras(bundle);
		IndexActivity.this.startActivity(intent);
    }
}